﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class NewsDetail : System.Web.UI.Page
{
    public string NewNews = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        int id = -1;
        try
        {
            id = Shove._Convert.StrToInt(this.Request["id"], -1);
        }
        catch
        {
            this.Response.Redirect("News.aspx", true);

            return;
        }

        if (id < 1)
        {
            this.Response.Redirect("News.aspx", true);

            return;
        }

        BindData(id);
    }

    private void BindData(int id)
    {
        DataTable dt = new DAL.Tables.tbl_Information().Open("", "ID="+id, "[DateTime] desc");

        if (dt == null)
        {
            //PublicFunction.GoError(ErrorNumber.DataReadWrite, "数据读写错误", this.GetType().BaseType.FullName);

            return;
        }

        if (dt.Rows.Count == 0)
        {
            //PublicFunction.GoError(ErrorNumber.NoData, "暂无数据", this.GetType().BaseType.FullName);

            return;
        }

        lbFrom.Text = "总公司";
        labTitle.Text = dt.Rows[0]["Title"].ToString();
        labTime.Text = dt.Rows[0]["DateTime"].ToString();
        try
        {
            labContent.Text = Shove._String.Decompress((byte[])dt.Rows[0]["Content"]);
        }
        catch { }
    }
}